package com.ta.oa.sys.common;


import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @Desc:全局异常捕获并返回
 */

@RestController
@ControllerAdvice
public class ExceptionHandlerController {


    @ExceptionHandler(Exception.class)
    public Result<String> defaultExceptionHandler(HttpServletRequest request, Exception e){
        return new Result<>(ResultEnum.SERVER_ERROR, e.getMessage());
    }
}
